import { defaultTheme, defineUserConfig } from 'vuepress';
import { searchPlugin } from '@vuepress/plugin-search';
import { markdownContainers } from './md-loader';
import { palettePlugin } from '@vuepress/plugin-palette';
import vueJsx from '@vitejs/plugin-vue-jsx';
import { viteBundler } from '@vuepress/bundler-vite';

export default defineUserConfig({
	lang: 'zh-CN',
	title: 'LUI',
	description: '这是我的第一个 VuePress 站点',
	markdown: {
		sfc: true,
		code: true,
	},
	plugins: [
		searchPlugin({
			locales: {
				'/': {
					placeholder: 'Search',
				},
				'/zh/': {
					placeholder: '搜索',
				},
			},
		}),
		palettePlugin({
			preset: 'sass',
		}),
		markdownContainers(),
	],
	bundler: viteBundler({
		viteOptions: {
			plugins: [vueJsx()],
		},
	}),
	theme: defaultTheme({
		sidebar: [
			{
				text: 'UI组件',
				children: [
					{
						text: '虚拟列表',
						link: '/uiComp/virtualList/README.md',
					},
				],
			},
			{
				text: 'Vue篇',
				children: [
					{
						text: '面试题',
						link: '/vue3/interview/index.md',
					},
				],
			},
			{
				text: 'JavaScript',
				children: [
					{
						text: '技巧',
						link: '/javascript/other/index.md',
					},
				],
			},
			{
				text: '小程序',
				children: [
					{
						text: '电商倒计时活动优化',
						link: '/miniProgram/other/index.md',
					},
					{
						text: '如何确保异步请求执行完后再执行各页面的onLoad方法',
						link: '/miniProgram/other/onLoad.md',
					},
				],
			},
		],
	}),
});
